//
//  ApplicationData.h
//  Asteroids
//
// This is a singleton that is used to keep all of the 'global' application data.
// This singleton will replace the traditional 'C' programming practice of creating
// globnal variables through out the code. In non-object oriented programming languages
// one source file it typically used to declare 'global' application data, and the
// '.h' file would contain the extern statements read by the users of that data.
// Here, we use a class for doing the same thing.
//
//  Created by Charles@Kollar.com on 11/11/10.
//
//
//  This program is free software: you can redistribute it and/or modify
//  it under the terms of the GNU General Public License as published by
//  the Free Software Foundation, either version 3 of the License, or
//  (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
//

#import <Foundation/Foundation.h>

#define MAX_LIVES						5

#define INITIAL_ASTEROID_COUNT			3


@interface ApplicationData : NSObject {
	NSMutableDictionary *rootObj;
	int currentScore;
	int lives;
	NSString *userName;
	int initialAsteroidCount;
}

@property (nonatomic, retain) NSMutableDictionary *rootObj;
@property int currentScore;
@property int lives;
@property (nonatomic, retain) NSString *userName;
@property int initialAsteroidCount;


// This is the class method that is used to access the singleton that will hold the
// ApplicationData for the game.
+ (id)shared;

// This is used by SaveScoreLayer to get a list of users to display in the table that it
// presents the user for selecting a userName for playing under.
- (NSMutableArray *)getLocalUsers;

// Used to add a user to the list of users on the device.
// This is NOT the userName. The userName is the name from the list of names on the device
// that the user has chosen (selected from a table in SaveScoreLayer).
- (void)addUser:(NSString*)name;

// Get the high score fot the current user (set with the 'addUser' method.
- (int)getHighScore;
- (void)setHighScore;

- (void)reload;
- (void)reset;

// Called in the AsteroidLayer class when a missile hits an asteroid
- (void)incrementCurrentScore;

// Called when ship hits an asteroid....
- (void)decrementLives;

// Used to save the application property list to a file, typically called in the 
// AppDelegate when the applicationWillTerminate.
- (void)save;

@end
